package com.LeeCode;

import java.util.Arrays;

/**
 * 基于排列构建数组
 */

public class Code1920 {
    public static void main(String[] args) {
        int[] nums = {0,2,1,5,3,4};

        int[] ans = new Code1920().buildArray(nums);

        System.out.println(Arrays.toString(ans));
    }

    public int[] buildArray(int[] nums) {

        int [] ans = new int[nums.length];

        for (int i = 0; i < nums.length; i++) {
            ans[i] = nums[nums[i]];
        }
        return ans;
    }
}
